package Cantella::DJabberd::Web::Controller::Admin::Vhost;

#the order the following IS RELEVANT
use base 'Cantella::DJabberd::Web::UI::Controller::Collection::CRUD';
use Reaction::Class;

__PACKAGE__->config
  (
   model_name => 'Admin',
   collection_name => 'vhosts',
   action =>
   { base => { Chained => '/admin/base', PathPart => 'vhost' },
     list => { 
              ViewPort => { 
                           excluded_fields => [qw/id/], 
                           field_order => [qw/hostname/],
                          }, 
             },
     create => { ViewPort =>
                 {
                  Field => { hostname => { layout => 'field/mutable/string' }, },
                 },
               },
     update => { ViewPort =>
                 {
                  Field => { hostname => { layout => 'field/mutable/string' }, },
                 },
               },
     view =>
     { #PathPart => "",
      ViewPort =>
      { field_order => [qw/hostname bridged_hosts external_components/],
        excluded_fields => [qw/id/],
      },
     },
   },
  );

sub base :Action :CaptureArgs(0) {
  my ($self, $c) = @_;
  $c->stash->{submenu}->current_item('vhosts');
}

1;
